{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "c928623b",
   "metadata": {},
   "source": [
    "# Community Services Data Set (CSDS)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "71405ccc",
   "metadata": {
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       ">Last modified: 28 Jul 2025"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import sys\n",
    "import os\n",
    "sys.path.append(os.path.abspath('../../../../scripts/'))\n",
    "from data_doc_helper import NHSEDataSet as DS, last_modified\n",
    "ds = DS(\"CSDS\")\n",
    "last_modified()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "91b35815",
   "metadata": {
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "<div style=\"background-color: rgba(0, 178, 169, 0.3); padding: 5px; border-radius: 5px;\"><strong>Children, young people and adults who are in contact with NHS funded organisations that provide community services in England.</strong></div>"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ds.three_sec_summary()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c7d719ca",
   "metadata": {},
   "source": [
    "## 1. Summary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "31f20bc2",
   "metadata": {
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "The CSDS contains data about children and adults including personal and demographic, social and personal circumstances, breastfeeding and nutrition, care event and screening activity, diagnoses, including long-term conditions and disabilities, scored assessments and weight management services. These activities could take place in settings such as health centres, Sure Start centres, day care facilities, schools or community centres, mobile facilities, or a patient’s own home. The dataset replaced the Children and Young People’s Health Services Data Set (CYPHS) which was restricted to those aged 18 years and under."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ds.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8c00184b",
   "metadata": {
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_1f2cb th {\n",
       "  text-align: left;\n",
       "}\n",
       "#T_1f2cb_row0_col0, #T_1f2cb_row0_col1, #T_1f2cb_row1_col0, #T_1f2cb_row1_col1, #T_1f2cb_row2_col0, #T_1f2cb_row2_col1, #T_1f2cb_row3_col0, #T_1f2cb_row3_col1, #T_1f2cb_row4_col0, #T_1f2cb_row4_col1, #T_1f2cb_row5_col0, #T_1f2cb_row5_col1, #T_1f2cb_row6_col0, #T_1f2cb_row6_col1, #T_1f2cb_row7_col0, #T_1f2cb_row7_col1, #T_1f2cb_row8_col0, #T_1f2cb_row8_col1, #T_1f2cb_row9_col0, #T_1f2cb_row9_col1, #T_1f2cb_row10_col0, #T_1f2cb_row10_col1, #T_1f2cb_row11_col0, #T_1f2cb_row11_col1, #T_1f2cb_row12_col0, #T_1f2cb_row12_col1, #T_1f2cb_row13_col0, #T_1f2cb_row13_col1, #T_1f2cb_row14_col0, #T_1f2cb_row14_col1 {\n",
       "  text-align: left;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_1f2cb\" style=\"font-size: 14px\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_1f2cb_level0_col0\" class=\"col_heading level0 col0\" >Dataset Descriptor</th>\n",
       "      <th id=\"T_1f2cb_level0_col1\" class=\"col_heading level0 col1\" >Dataset-specific Information</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row0_col0\" class=\"data row0 col0\" >Name of Dataset in TRE</td>\n",
       "      <td id=\"T_1f2cb_row0_col1\" class=\"data row0 col1\" >NHSE_CSDS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row1_col0\" class=\"data row1 col0\" >Citation (APA)</td>\n",
       "      <td id=\"T_1f2cb_row1_col1\" class=\"data row1 col1\" >Data Services, NHS England (NHSE). (2024). <i>NHS England: Community Services Data Set (CSDS).</i> UK Longitudinal Linkage Collaboration (UK LLC).  <a href=\"https://doi.org/10.71760/ukllc-dataset-00364-03\" rel=\"noopener noreferrer\" target=\"_blank\">https://doi.org/10.71760/ukllc-dataset-00364-03</a></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row2_col0\" class=\"data row2 col0\" >Download Citation</td>\n",
       "      <td id=\"T_1f2cb_row2_col1\" class=\"data row2 col1\" > <a href=\"https://api.datacite.org/application/vnd.citationstyles.csl+json/10.71760/ukllc-dataset-00364-03\" rel=\"noopener noreferrer\" target=\"_blank\">Citeproc JSON</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href=\"https://api.datacite.org/application/x-bibtex/10.71760/ukllc-dataset-00364-03\" rel=\"noopener noreferrer\" target=\"_blank\">BibTeX</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href=\"https://api.datacite.org/application/x-research-info-systems/10.71760/ukllc-dataset-00364-03\" rel=\"noopener noreferrer\" target=\"_blank\">RIS</a></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row3_col0\" class=\"data row3 col0\" >Series</td>\n",
       "      <td id=\"T_1f2cb_row3_col1\" class=\"data row3 col1\" > <a href=\"https://guidebook.ukllc.ac.uk/docs//linked_health_data/NHS_England/NHSE_intro\" rel=\"noopener noreferrer\" target=\"_blank\">NHS England</a></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row4_col0\" class=\"data row4 col0\" >Owner</td>\n",
       "      <td id=\"T_1f2cb_row4_col1\" class=\"data row4 col1\" >NHS England</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row5_col0\" class=\"data row5 col0\" >Temporal Coverage in the TRE</td>\n",
       "      <td id=\"T_1f2cb_row5_col1\" class=\"data row5 col1\" >04/2015 - ongoing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row6_col0\" class=\"data row6 col0\" >Geographical Coverage</td>\n",
       "      <td id=\"T_1f2cb_row6_col1\" class=\"data row6 col1\" >England</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row7_col0\" class=\"data row7 col0\" >Participant Count</td>\n",
       "      <td id=\"T_1f2cb_row7_col1\" class=\"data row7 col1\" >N/A - Dataset comprises of multiple auxiliary tables</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row8_col0\" class=\"data row8 col0\" >Number of Variables</td>\n",
       "      <td id=\"T_1f2cb_row8_col1\" class=\"data row8 col1\" >N/A - Dataset comprises of multiple auxiliary tables</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row9_col0\" class=\"data row9 col0\" >Number of Observations</td>\n",
       "      <td id=\"T_1f2cb_row9_col1\" class=\"data row9 col1\" >N/A - Dataset comprises of multiple auxiliary tables</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row10_col0\" class=\"data row10 col0\" >Key Link</td>\n",
       "      <td id=\"T_1f2cb_row10_col1\" class=\"data row10 col1\" > <a href=\"https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/community-services-data-set\" rel=\"noopener noreferrer\" target=\"_blank\">https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/community-services-data-set</a></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row11_col0\" class=\"data row11 col0\" >Keywords</td>\n",
       "      <td id=\"T_1f2cb_row11_col1\" class=\"data row11 col1\" >Community</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row12_col0\" class=\"data row12 col0\" >Latest Extract Date</td>\n",
       "      <td id=\"T_1f2cb_row12_col1\" class=\"data row12 col1\" >2024-04-26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row13_col0\" class=\"data row13 col0\" >Specific Restrictions to Data Use</td>\n",
       "      <td id=\"T_1f2cb_row13_col1\" class=\"data row13 col1\" >None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_1f2cb_row14_col0\" class=\"data row14 col0\" >Build a Data Request</td>\n",
       "      <td id=\"T_1f2cb_row14_col1\" class=\"data row14 col1\" > <a href=\"https://explore.ukllc.ac.uk/\" rel=\"noopener noreferrer\" target=\"_blank\">https://explore.ukllc.ac.uk/</a></td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x1e7b466aa50>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds.info_table()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ebf55707",
   "metadata": {},
   "source": [
    "## 2. Metrics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "33994195",
   "metadata": {
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "application/javascript": "'use strict';\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  const force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\nconst JS_MIME_TYPE = 'application/javascript';\n  const HTML_MIME_TYPE = 'text/html';\n  const EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n  const CLASS_NAME = 'output_bokeh rendered_html';\n\n  /**\n   * Render data to the DOM node\n   */\n  function render(props, node) {\n    const script = document.createElement(\"script\");\n    node.appendChild(script);\n  }\n\n  /**\n   * Handle when an output is cleared or removed\n   */\n  function handleClearOutput(event, handle) {\n    function drop(id) {\n      const view = Bokeh.index.get_by_id(id)\n      if (view != null) {\n        view.model.document.clear()\n        Bokeh.index.delete(view)\n      }\n    }\n\n    const cell = handle.cell;\n\n    const id = cell.output_area._bokeh_element_id;\n    const server_id = cell.output_area._bokeh_server_id;\n\n    // Clean up Bokeh references\n    if (id != null) {\n      drop(id)\n    }\n\n    if (server_id !== undefined) {\n      // Clean up Bokeh references\n      const cmd_clean = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n      cell.notebook.kernel.execute(cmd_clean, {\n        iopub: {\n          output: function(msg) {\n            const id = msg.content.text.trim()\n            drop(id)\n          }\n        }\n      });\n      // Destroy server and session\n      const cmd_destroy = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n      cell.notebook.kernel.execute(cmd_destroy);\n    }\n  }\n\n  /**\n   * Handle when a new output is added\n   */\n  function handleAddOutput(event, handle) {\n    const output_area = handle.output_area;\n    const output = handle.output;\n\n    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n    if ((output.output_type != \"display_data\") || (!Object.prototype.hasOwnProperty.call(output.data, EXEC_MIME_TYPE))) {\n      return\n    }\n\n    const toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n\n    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n      // store reference to embed id on output_area\n      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n    }\n    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n      const bk_div = document.createElement(\"div\");\n      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n      const script_attrs = bk_div.children[0].attributes;\n      for (let i = 0; i < script_attrs.length; i++) {\n        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n      }\n      // store reference to server id on output_area\n      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n    }\n  }\n\n  function register_renderer(events, OutputArea) {\n\n    function append_mime(data, metadata, element) {\n      // create a DOM node to render to\n      const toinsert = this.create_output_subarea(\n        metadata,\n        CLASS_NAME,\n        EXEC_MIME_TYPE\n      );\n      this.keyboard_manager.register_events(toinsert);\n      // Render to node\n      const props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n      render(props, toinsert[toinsert.length - 1]);\n      element.append(toinsert);\n      return toinsert\n    }\n\n    /* Handle when an output is cleared or removed */\n    events.on('clear_output.CodeCell', handleClearOutput);\n    events.on('delete.Cell', handleClearOutput);\n\n    /* Handle when a new output is added */\n    events.on('output_added.OutputArea', handleAddOutput);\n\n    /**\n     * Register the mime type and append_mime function with output_area\n     */\n    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n      /* Is output safe? */\n      safe: true,\n      /* Index of renderer in `output_area.display_order` */\n      index: 0\n    });\n  }\n\n  // register the mime type if in Jupyter Notebook environment and previously unregistered\n  if (root.Jupyter !== undefined) {\n    const events = require('base/js/events');\n    const OutputArea = require('notebook/js/outputarea').OutputArea;\n\n    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n      register_renderer(events, OutputArea);\n    }\n  }\n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  const NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded(error = null) {\n    const el = document.getElementById(null);\n    if (el != null) {\n      const html = (() => {\n        if (typeof root.Bokeh === \"undefined\") {\n          if (error == null) {\n            return \"BokehJS is loading ...\";\n          } else {\n            return \"BokehJS failed to load.\";\n          }\n        } else {\n          const prefix = `BokehJS ${root.Bokeh.version}`;\n          if (error == null) {\n            return `${prefix} successfully loaded.`;\n          } else {\n            return `${prefix} <b>encountered errors</b> while loading and may not function as expected.`;\n          }\n        }\n      })();\n      el.innerHTML = html;\n\n      if (error != null) {\n        const wrapper = document.createElement(\"div\");\n        wrapper.style.overflow = \"auto\";\n        wrapper.style.height = \"5em\";\n        wrapper.style.resize = \"vertical\";\n        const content = document.createElement(\"div\");\n        content.style.fontFamily = \"monospace\";\n        content.style.whiteSpace = \"pre-wrap\";\n        content.style.backgroundColor = \"rgb(255, 221, 221)\";\n        content.textContent = error.stack ?? error.toString();\n        wrapper.append(content);\n        el.append(wrapper);\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(() => display_loaded(error), 100);\n    }\n  }\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error(url) {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (let i = 0; i < css_urls.length; i++) {\n      const url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error.bind(null, url);\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    for (let i = 0; i < js_urls.length; i++) {\n      const url = js_urls[i];\n      const element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error.bind(null, url);\n      element.async = false;\n      element.src = url;\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-3.7.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.7.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.7.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.7.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-3.7.2.min.js\"];\n  const css_urls = [];\n\n  const inline_js = [    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\nfunction(Bokeh) {\n    }\n  ];\n\n  function run_inline_js() {\n    if (root.Bokeh !== undefined || force === true) {\n      try {\n            for (let i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n\n      } catch (error) {throw error;\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      const cell = $(document.getElementById(null)).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));",
      "application/vnd.bokehjs_load.v0+json": ""
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "Click on the plus sign to see the number of participants represented in each dataset."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "**Table 2:** Participants from each LPS represented in the CSDS dataset in the UK LLC TRE. **Note:** Individual cohort counts of less than 10 are suppressed to <10 and excluded from total participant counts for datasets."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "  <div id=\"ff5cf385-97b2-41fc-baab-e8410756d7e0\" data-root-id=\"p1017\" style=\"display: contents;\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": "(function(root) {\n  function embed_document(root) {\n  const docs_json = {\"a785ac9b-b8b7-46f2-a6cd-94513530c330\":{\"version\":\"3.7.2\",\"title\":\"Bokeh Application\",\"roots\":[{\"type\":\"object\",\"name\":\"DataCube\",\"id\":\"p1017\",\"attributes\":{\"source\":{\"type\":\"object\",\"name\":\"ColumnDataSource\",\"id\":\"p1001\",\"attributes\":{\"selected\":{\"type\":\"object\",\"name\":\"Selection\",\"id\":\"p1002\",\"attributes\":{\"indices\":[],\"line_indices\":[]}},\"selection_policy\":{\"type\":\"object\",\"name\":\"UnionRenderers\",\"id\":\"p1003\"},\"data\":{\"type\":\"map\",\"entries\":[[\"d0\",[\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_rtt\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_activities\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_care_plans\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_coded_scored_assessments\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_demographics_and_referral\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_diagnoses\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_immunisations\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\",\"CSDS_onward_referrals\"]],[\"d1\",[\"ALSPAC\",\"BCS70\",\"BIB\",\"ELSA\",\"EPICN\",\"EXCEED\",\"FENLAND\",\"GLAD\",\"MCS\",\"NCDS58\",\"NEXTSTEP\",\"NIHRBIO_COPING\",\"NSHD46\",\"TEDS\",\"TRACKC19\",\"TWINSUK\",\"UKHLS\",\"ALSPAC\",\"BCS70\",\"BIB\",\"ELSA\",\"EPICN\",\"EXCEED\",\"FENLAND\",\"GLAD\",\"MCS\",\"NCDS58\",\"NEXTSTEP\",\"NIHRBIO_COPING\",\"NSHD46\",\"TEDS\",\"TRACKC19\",\"TWINSUK\",\"UKHLS\",\"ALSPAC\",\"BCS70\",\"BIB\",\"ELSA\",\"EPICN\",\"EXCEED\",\"FENLAND\",\"GLAD\",\"MCS\",\"NCDS58\",\"NEXTSTEP\",\"NIHRBIO_COPING\",\"NSHD46\",\"TEDS\",\"TRACKC19\",\"TWINSUK\",\"UKHLS\",\"ALSPAC\",\"BCS70\",\"BIB\",\"ELSA\",\"EPICN\",\"EXCEED\",\"FENLAND\",\"GLAD\",\"MCS\",\"NCDS58\",\"NEXTSTEP\",\"NIHRBIO_COPING\",\"NSHD46\",\"TEDS\",\"TRACKC19\",\"TWINSUK\",\"UKHLS\",\"ALSPAC\",\"BCS70\",\"BIB\",\"ELSA\",\"EPICN\",\"EXCEED\",\"FENLAND\",\"GLAD\",\"MCS\",\"NCDS58\",\"NEXTSTEP\",\"NIHRBIO_COPING\",\"NSHD46\",\"TEDS\",\"TRACKC19\",\"TWINSUK\",\"UKHLS\",\"ALSPAC\",\"BCS70\",\"BIB\",\"ELSA\",\"EPICN\",\"EXCEED\",\"FENLAND\",\"GLAD\",\"MCS\",\"NCDS58\",\"NEXTSTEP\",\"NIHRBIO_COPING\",\"NSHD46\",\"TEDS\",\"TRACKC19\",\"TWINSUK\",\"UKHLS\",\"ALSPAC\",\"BCS70\",\"BIB\",\"ELSA\",\"EPICN\",\"EXCEED\",\"FENLAND\",\"GLAD\",\"MCS\",\"NCDS58\",\"NEXTSTEP\",\"NIHRBIO_COPING\",\"NSHD46\",\"TEDS\",\"TRACKC19\",\"TWINSUK\",\"UKHLS\",\"ALSPAC\",\"BCS70\",\"BIB\",\"ELSA\",\"EPICN\",\"EXCEED\",\"FENLAND\",\"GLAD\",\"MCS\",\"NCDS58\",\"NEXTSTEP\",\"NIHRBIO_COPING\",\"NSHD46\",\"TEDS\",\"TRACKC19\",\"TWINSUK\",\"UKHLS\"]],[\"px\",[183.0,646.0,1382.0,1563.0,9007.0,3128.0,3425.0,11361.0,1753.0,916.0,456.0,2784.0,479.0,523.0,1735.0,1831.0,1035.0,1855.0,1536.0,15536.0,3524.0,9623.0,4258.0,3739.0,27398.0,4787.0,2180.0,1800.0,5593.0,1200.0,1690.0,4040.0,4586.0,2300.0,21.0,109.0,429.0,552.0,4587.0,30.0,301.0,1980.0,347.0,203.0,56.0,478.0,162.0,54.0,291.0,533.0,207.0,{\"type\":\"number\",\"value\":\"nan\"},{\"type\":\"number\",\"value\":\"nan\"},{\"type\":\"number\",\"value\":\"nan\"},25.0,{\"type\":\"number\",\"value\":\"nan\"},113.0,{\"type\":\"number\",\"value\":\"nan\"},43.0,{\"type\":\"number\",\"value\":\"nan\"},11.0,0.0,21.0,{\"type\":\"number\",\"value\":\"nan\"},0.0,17.0,18.0,10.0,2502.0,2007.0,20900.0,4024.0,10483.0,4761.0,4490.0,36840.0,8345.0,2610.0,2321.0,6956.0,1381.0,2401.0,5168.0,5816.0,2964.0,29.0,270.0,1340.0,800.0,2191.0,54.0,422.0,4015.0,727.0,414.0,154.0,904.0,266.0,160.0,712.0,771.0,423.0,{\"type\":\"number\",\"value\":\"nan\"},{\"type\":\"number\",\"value\":\"nan\"},6392.0,{\"type\":\"number\",\"value\":\"nan\"},{\"type\":\"number\",\"value\":\"nan\"},11.0,0.0,2707.0,1323.0,{\"type\":\"number\",\"value\":\"nan\"},17.0,46.0,{\"type\":\"number\",\"value\":\"nan\"},36.0,{\"type\":\"number\",\"value\":\"nan\"},87.0,64.0,14.0,60.0,546.0,218.0,222.0,52.0,802.0,1144.0,229.0,116.0,50.0,400.0,56.0,33.0,203.0,253.0,95.0]]]}}},\"view\":{\"type\":\"object\",\"name\":\"CDSView\",\"id\":\"p1021\",\"attributes\":{\"filter\":{\"type\":\"object\",\"name\":\"AllIndices\",\"id\":\"p1022\"}}},\"columns\":[{\"type\":\"object\",\"name\":\"TableColumn\",\"id\":\"p1008\",\"attributes\":{\"field\":\"d1\",\"title\":\"CSDS Dataset\",\"width\":80,\"formatter\":{\"type\":\"object\",\"name\":\"StringFormatter\",\"id\":\"p1007\",\"attributes\":{\"font_style\":{\"type\":\"value\",\"value\":\"bold\"}}},\"editor\":{\"type\":\"object\",\"name\":\"StringEditor\",\"id\":\"p1010\"},\"sortable\":false}},{\"type\":\"object\",\"name\":\"TableColumn\",\"id\":\"p1012\",\"attributes\":{\"field\":\"px\",\"title\":\"Participant Count\",\"width\":40,\"formatter\":{\"type\":\"object\",\"name\":\"StringFormatter\",\"id\":\"p1011\",\"attributes\":{\"text_align\":{\"type\":\"value\",\"value\":\"right\"},\"nan_format\":\"<10\"}},\"editor\":{\"type\":\"object\",\"name\":\"StringEditor\",\"id\":\"p1014\"},\"sortable\":false}}],\"grouping\":[{\"type\":\"object\",\"name\":\"GroupingInfo\",\"id\":\"p1016\",\"attributes\":{\"getter\":\"d0\",\"aggregators\":[{\"type\":\"object\",\"name\":\"SumAggregator\",\"id\":\"p1015\",\"attributes\":{\"field_\":\"px\"}}]}}],\"target\":{\"type\":\"object\",\"name\":\"ColumnDataSource\",\"id\":\"p1004\",\"attributes\":{\"selected\":{\"type\":\"object\",\"name\":\"Selection\",\"id\":\"p1005\",\"attributes\":{\"indices\":[],\"line_indices\":[]}},\"selection_policy\":{\"type\":\"object\",\"name\":\"UnionRenderers\",\"id\":\"p1006\"},\"data\":{\"type\":\"map\",\"entries\":[[\"row_indices\",[]],[\"labels\",[]]]}}}}}]}};\n  const render_items = [{\"docid\":\"a785ac9b-b8b7-46f2-a6cd-94513530c330\",\"roots\":{\"p1017\":\"ff5cf385-97b2-41fc-baab-e8410756d7e0\"},\"root_ids\":[\"p1017\"]}];\n  void root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n  }\n  if (root.Bokeh !== undefined) {\n    embed_document(root);\n  } else {\n    let attempts = 0;\n    const timer = setInterval(function(root) {\n      if (root.Bokeh !== undefined) {\n        clearInterval(timer);\n        embed_document(root);\n      } else {\n        attempts++;\n        if (attempts > 100) {\n          clearInterval(timer);\n          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n        }\n      }\n    }, 10, root)\n  }\n})(window);",
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "p1017"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "ds.metrics()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2d7fecf8",
   "metadata": {},
   "source": [
    "## 3. Version History"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "a176d142",
   "metadata": {
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_27f3c th {\n",
       "  text-align: left;\n",
       "}\n",
       "#T_27f3c_row0_col0, #T_27f3c_row0_col1, #T_27f3c_row0_col2, #T_27f3c_row1_col0, #T_27f3c_row1_col1, #T_27f3c_row1_col2, #T_27f3c_row2_col0, #T_27f3c_row2_col1, #T_27f3c_row2_col2, #T_27f3c_row3_col0, #T_27f3c_row3_col1, #T_27f3c_row3_col2, #T_27f3c_row4_col0, #T_27f3c_row4_col1, #T_27f3c_row4_col2 {\n",
       "  text-align: left;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_27f3c\" style=\"font-size: 14px\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_27f3c_level0_col0\" class=\"col_heading level0 col0\" >Version</th>\n",
       "      <th id=\"T_27f3c_level0_col1\" class=\"col_heading level0 col1\" >2</th>\n",
       "      <th id=\"T_27f3c_level0_col2\" class=\"col_heading level0 col2\" >3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_27f3c_row0_col0\" class=\"data row0 col0\" >Version Date</td>\n",
       "      <td id=\"T_27f3c_row0_col1\" class=\"data row0 col1\" >13 Apr 2023</td>\n",
       "      <td id=\"T_27f3c_row0_col2\" class=\"data row0 col2\" >26 Apr 2024</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_27f3c_row1_col0\" class=\"data row1 col0\" >Number of Variables</td>\n",
       "      <td id=\"T_27f3c_row1_col1\" class=\"data row1 col1\" >138</td>\n",
       "      <td id=\"T_27f3c_row1_col2\" class=\"data row1 col2\" >153</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_27f3c_row2_col0\" class=\"data row2 col0\" >Number of Observations</td>\n",
       "      <td id=\"T_27f3c_row2_col1\" class=\"data row2 col1\" >875112</td>\n",
       "      <td id=\"T_27f3c_row2_col2\" class=\"data row2 col2\" >1174751</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_27f3c_row3_col0\" class=\"data row3 col0\" >DOI</td>\n",
       "      <td id=\"T_27f3c_row3_col1\" class=\"data row3 col1\" > <a href=\"https://doi.org/10.71760/ukllc-dataset-00364-02\" rel=\"noopener noreferrer\" target=\"_blank\">10.71760/ukllc-dataset-00364-02</a></td>\n",
       "      <td id=\"T_27f3c_row3_col2\" class=\"data row3 col2\" > <a href=\"https://doi.org/10.71760/ukllc-dataset-00364-03\" rel=\"noopener noreferrer\" target=\"_blank\">10.71760/ukllc-dataset-00364-03</a></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_27f3c_row4_col0\" class=\"data row4 col0\" >Change Log</td>\n",
       "      <td id=\"T_27f3c_row4_col1\" class=\"data row4 col1\" > <a href=\"https://api.test.datacite.org/dois/10.71760/ukllc-dataset-00364-02/activities\" rel=\"noopener noreferrer\" target=\"_blank\">10.71760/ukllc-dataset-00364-02/activities</a></td>\n",
       "      <td id=\"T_27f3c_row4_col2\" class=\"data row4 col2\" > <a href=\"https://api.test.datacite.org/dois/10.71760/ukllc-dataset-00364-03/activities\" rel=\"noopener noreferrer\" target=\"_blank\">10.71760/ukllc-dataset-00364-03/activities</a></td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x1e7b4901090>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds.version_history()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "12e6b815",
   "metadata": {},
   "source": [
    "## 4. Documentation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "02e29089",
   "metadata": {
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "We are currently building a documentation storage system which will host useful documents related to datasets and data owners. We will surface these documents on Guidebook."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ds.documentation()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ecce32ec",
   "metadata": {},
   "source": [
    "## 5. Useful Syntax"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ee22f894",
   "metadata": {
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "Below we will include syntax that may be helpful to other researchers in the UK LLC TRE. For longer scripts, we will include a snippet of the code plus a link to the [UK LLC GitHub](https://github.com/UKLLC) repository where you can find the full scripts."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ds.useful_syntax()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "jupbook",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}